<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02DOM练习</title>
</head>
<body>
    <h1>我是标题：<span class="s"></span></h1>

    <input type="text" id="i1">
    <input type="text" id="i2">
    <button onclick="f1()">按钮1</button>
    <button onclick="f2()">按钮2</button>
    <script>
        function f1(){
            // 根据类选择器获取span中的元素
            var element = document.querySelector('.s');
            console.log(element);
            // 设置span中的文字
            element.innerHTML = 'hahahha';
        }
        function f2(){
            let input1 = document.querySelector('#i1');
            let input2 = document.getElementById('i2');
            console.log(input1.value);
            console.log(typeof  input1.value);
            let i1 = parseFloat(input1.value);
            console.log(i1, typeof i1 )

            console.log(input2);

        }
    </script>
</body>
</html>